package dancrawler.server;

import java.util.HashSet;

public class GeneratedTile extends Tile {

    private Connector conn;

    public GeneratedTile(int x, int y, String name, boolean block,Gameworld gw, Connector c) {
        super(x, y, name, block,gw);
        conn = c;
    }

    public void connectTo(GeneratedTile t) {
        if (conn==null){this.conn=t.conn;}
        else if(t.conn == null)
        {
            t.conn=conn;
        }
        else
        {
        }
        conn.c.addAll(t.conn.c);
        t.conn.c.addAll(conn.c);

    }
    
    public boolean isConnectedTo(Cell cell){
        if (conn==null){return false;}
        return conn.c.contains(cell);
    }

    public static class Connector {

        private HashSet<Cell> c = new HashSet();

        public void add(Cell cell) {
            c.add(cell);
        }
               
    }
}
